// 获取首页前5篇文章
export const getNewFiveArticleApi = (proxy) => {
	return proxy.http.post('/getNewFiveArticle')
}


// 获取所有的一级分类
export const getParentCategoryApi = (proxy) => {
	return proxy.http.post('/getParentCategory')
}

// 根据分类获取文章内容
export const getContentByCategoryApi = (proxy, data) => {
	return proxy.http.post('/getContentByCategory', {
		showLoading: false,
		data
	})
}

// 登录
export const loginApi = (proxy, {
	appid,
	secret,
	code
}) => {
	return proxy.http.get(
		`https://api.weixin.qq.com/sns/jscode2session?appid=${appid}&secret=${secret}&js_code=${code}&grant_type=authorization_code`, {
			host: ''
		}
	)
}

// 生成网站用户、绑定openid
export const wzLoginApi = (proxy, data) => {
	return proxy.http.post('/userLogin', {
		showLoading: false,
		data
	})
}

// 根据文章id获取评论
export const getCommentByArticleIdApi = (proxy, data) => {
	return proxy.http.post('/getCommentByArticleId', {
		data
	})
}


// 根据评论id删除评论
export const delCommentByIdApi = (proxy, data) => {
	return proxy.http.post('/delCommentById', {
		data
	})
}